package observer;

import observer.api.AriObserver;
import observer.api.TemperatureObserevr;
import observer.api.WeatherSubject;

import java.util.Observer;

public class TestMain {
    public static void main(String[] args) {
        WeatherSubject observable = new WeatherSubject();

        //注册观察者
        Observer airObserver = new AriObserver(observable);
        Observer tempObserver = new TemperatureObserevr(observable);

        //消息变更
        ChangeMessage changeMessage = new ChangeMessage();
        changeMessage.setAirMessage("天气晴");
        changeMessage.setTemperature(20L);
        observable.changeMessage(changeMessage);
        System.out.println("=========================================");
        changeMessage.setAirMessage("下雨天");
        changeMessage.setTemperature(10L);
        observable.changeMessage(changeMessage);
    }
}
